package com.example.demo.service;

import com.example.demo.entity.OrderStatus;
import com.example.demo.repository.OrderStatusRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Service
public class OrderStatusService {

    @Autowired
    OrderStatusRepository orderStatusRepository;

    public OrderStatus getOrderStatus(@PathVariable("id") Integer id){
        OrderStatus orderStatus = orderStatusRepository.findOne(id);
        return orderStatus;
    }

    @GetMapping("/orderStatus")
    public OrderStatus insertOrderStatus(OrderStatus orderStatus){
        OrderStatus save = orderStatusRepository.save(orderStatus);
        return  save;
    }
}
